package com.njupt.swg.threadstudyjimin.item05.singleton;

import com.njupt.swg.threadstudyjimin.annotation.NotThreadSafe;

import java.util.Stack;

/**
 * 懒汉模式，线程不安全
 */
@NotThreadSafe
public class SingletonExample1 {
    private SingletonExample1(){}

    private static SingletonExample1 instance = null;

    //静态工厂方法
    public static SingletonExample1 getInstance(){
        if(instance == null){
            instance = new SingletonExample1();
        }
        return instance;
    }
}
